package com.baor.web.controller.finance;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baor.common.annotation.Log;
import com.baor.common.core.controller.BaseController;
import com.baor.common.core.domain.AjaxResult;
import com.baor.common.enums.BusinessType;
import com.baor.finance.domain.Tixian;
import com.baor.finance.service.ITixianService;
import com.baor.common.utils.poi.ExcelUtil;
import com.baor.common.core.page.TableDataInfo;

/**
 * 会员提现Controller
 * 
 * @author ruoyi
 * @date 2025-07-21
 */
@RestController
@RequestMapping("/finance/tixian")
public class TixianController extends BaseController
{
    @Autowired
    private ITixianService tixianService;

    @GetMapping("/total2")
    public AjaxResult total(){
        return success(tixianService.tixianTotle());
    }

    @GetMapping("/tixianyes/{tixianId}")
    public AjaxResult yseType(@PathVariable Long tixianId){
        return toAjax(tixianService.tixianYes(tixianId));
    }

    @GetMapping("/tixianno/{tixianId}")
    public AjaxResult yseNo(@PathVariable Long tixianId){
        return toAjax(tixianService.tixianNo(tixianId));
    }

    /**
     * 查询会员提现列表
     */
    @PreAuthorize("@ss.hasPermi('finance:tixian:list')")
    @GetMapping("/list")
    public TableDataInfo list(Tixian tixian)
    {
        startPage();
        List<Tixian> list = tixianService.selectTixianList(tixian);
        return getDataTable(list);
    }

    /**
     * 导出会员提现列表
     */
    @PreAuthorize("@ss.hasPermi('finance:tixian:export')")
    @Log(title = "会员提现", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Tixian tixian)
    {
        List<Tixian> list = tixianService.selectTixianList(tixian);
        ExcelUtil<Tixian> util = new ExcelUtil<Tixian>(Tixian.class);
        util.exportExcel(response, list, "会员提现数据");
    }

    /**
     * 获取会员提现详细信息
     */
    @PreAuthorize("@ss.hasPermi('finance:tixian:query')")
    @GetMapping(value = "/{tixianId}")
    public AjaxResult getInfo(@PathVariable("tixianId") Long tixianId)
    {
        return success(tixianService.selectTixianByTixianId(tixianId));
    }

    /**
     * 新增会员提现
     */
    @PreAuthorize("@ss.hasPermi('finance:tixian:add')")
    @Log(title = "会员提现", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Tixian tixian)
    {
        return toAjax(tixianService.insertTixian(tixian));
    }

    /**
     * 修改会员提现
     */
    @PreAuthorize("@ss.hasPermi('finance:tixian:edit')")
    @Log(title = "会员提现", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Tixian tixian)
    {
        return toAjax(tixianService.updateTixian(tixian));
    }

    /**
     * 删除会员提现
     */
    @PreAuthorize("@ss.hasPermi('finance:tixian:remove')")
    @Log(title = "会员提现", businessType = BusinessType.DELETE)
	@DeleteMapping("/{tixianIds}")
    public AjaxResult remove(@PathVariable Long[] tixianIds)
    {
        return toAjax(tixianService.deleteTixianByTixianIds(tixianIds));
    }
}
